package com.puppet.building182.mapper;

import com.puppet.building182.pojo.User;
import com.puppet.building182.pojo.VO.UseVO;
import com.puppet.building182.pojo.VO.UserVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserMapper {
    @Select("select*from userinfo")
    List<UserVo> getUser();

    @Delete("delete from userinfo where id=#{id}")
    Integer deleteById(Integer id);

    @Select("select * from userinfo where id=#{id}")
    UserVo getUserById(Integer id);

    @Update("update userinfo set username=#{username} where id=#{id}")
    Integer updateUser(User user);

    @Select("select id,username,pic,type,userinfo.remarks,status,create_time from userinfo where username=#{username} and password=#{password}")
    User login(UseVO users);

    @Update("update userinfo set username=#{username},password=#{password},pic=#{pic},remarks=#{remarks} where id=#{id}")
    Integer updateAllUser(User users);
    @Select("select *from userinfo where username=#{username}")
    User getUserByUsername(String username);
}
